package com.shinaier.laundry.snlstore.setting.adapter;

import android.content.Context;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.common.adapter.BaseAdapterNew;
import com.common.adapter.ViewHolder;
import com.shinaier.laundry.snlstore.R;
import com.shinaier.laundry.snlstore.network.entity.MerchantCardInfoEntity;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by 张家洛 on 2017/12/12.
 */

public class MerchantCardInfoAdapter extends BaseAdapterNew<MerchantCardInfoEntity.MerchantCardInfoResult> {
    private Map<Integer,MyEt> map = new HashMap<>();
    private int position1;

    public Map<Integer, MyEt> getMap() {
        return map;
    }

    public MerchantCardInfoAdapter(Context context, List<MerchantCardInfoEntity.MerchantCardInfoResult> mDatas) {
        super(context, mDatas);
    }

    @Override
    protected int getResourceId(int Position) {
        return R.layout.merchant_card_info_item;
    }

    @Override
    protected void setViewData(View convertView,int position) {
        MerchantCardInfoEntity.MerchantCardInfoResult item = getItem(position);
        TextView merchantCardType = ViewHolder.get(convertView,R.id.merchant_card_type);
        EditText merchantCardDiscount = ViewHolder.get(convertView, R.id.merchant_card_discount);
        EditText merchantCardMoney = ViewHolder.get(convertView, R.id.merchant_card_money);

        if (item != null){
            merchantCardType.setText(item.getCardName());
            merchantCardDiscount.setText(item.getDiscount());
            merchantCardMoney.setText(item.getPrice());
            map.put(position,new MyEt(merchantCardDiscount, merchantCardMoney));
        }

    }

    public class MyEt {
        EditText et1;
        EditText et2;

        public MyEt(EditText et1,EditText et2) {
            this.et1 = et1;
            this.et2 = et2;
        }

        public EditText getEt1() {
            return et1;
        }

        public void setEt1(EditText et1) {
            this.et1 = et1;
        }

        public EditText getEt2() {
            return et2;
        }

        public void setEt2(EditText et2) {
            this.et2 = et2;
        }
    }
}
